/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ParameterBinderTexture2D.cpp
*
*	Comments	-	See ParameterBinderTexture2D.h
*
**************************************************************************************/
#include "../Include/ParameterBinderTexture2D.h"
#include "../Include/ParameterTexture2D.h"
#include "../Include/ParameterShaderResource.h"
#include "../Include/Texture2D.h"

namespace Pulse
{
	ParameterBinderTexture2D::ParameterBinderTexture2D( void )
		: m_pData( PSX_NULL )
	{
		
	}

	ParameterBinderTexture2D::ParameterBinderTexture2D( IParameter *pParam )
		: m_pData( PSX_NULL )
	{
		SetParameter( pParam );
	}

	ParameterBinderTexture2D::~ParameterBinderTexture2D( void ) 
	{
		if ( m_pData )
			m_pData->Release();
	}

	void ParameterBinderTexture2D::SetData( Texture2D *pData )
	{
		if ( m_pData )
			m_pData->Release();

		m_pData = pData;

		if ( pData )
			pData->AddRef();
	}

	void ParameterBinderTexture2D::BindValue( void )
	{
		m_pShaderResourceParam->SetResource( m_pData );
	}

}